<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var obj = {
        color: "red",
      };
      var color = "blue";
      function sayColor(a, b) {
        console.log(this.color, a, b);
      }
      sayColor();
      Function.prototype.myCall = function (obj) {
        let args = Array.prototype.slice.call(arguments, 1);
        obj.sayColor = this;
        eval(`obj.sayColor(${args})`);
        delete obj.sayColor;
      };
      sayColor.myCall(obj, 1, 2);
    </script>
  </body>
</html>
